<!--
医院管理-医院维护增加
 add by yyp 2020-01-12
-->
<template lang="pug">
  kalix-dialog.user-add(bizKey="Reportvideo" ref="kalixBizDialog" v-bind:formModel.sync="formModel" v-bind:targetURL="targetURL" v-bind:submitCustom="submitCustom")
    div.el-form(slot="dialogFormSlot" style=" width:60%;margin:auto;")
      <!--el-form-item(label="关联报告id" prop="rId" v-bind:label-width="labelWidth" v-bind:rules="rules.rId")-->
        <!--el-input(v-model="formModel.rId" style="width:80%")-->
      el-form-item.short(label="关联报告id" prop="rId" v-bind:label-width="labelWidth" v-bind:rules="rules.rId" )
        el-input(v-model="formModel.rId" )
      el-form-item.short(label="患者姓名" prop="rName" v-bind:label-width="labelWidth" v-bind:rules="rules.rName" )
        el-select(v-model="formModel.rId" filterable placeholder="请选择患者" @change="getUid" style="width:100%")
          el-option(v-for="item in patientName" v-bind:key="item.id" v-bind:label="item.name" v-bind:value="item.id")
      el-form-item(label="视频地址" prop="videoUrl" v-bind:label-width="labelWidth" v-bind:rules="rules.videoUrl")
        el-input(v-model="formModel.videoUrl" style="width:80%")
</template>

<script type="text/ecmascript-6">
  import FormModel from './model'
  import {ReportVideoURL} from '../../config.toml'
  import KalixClansmanUpload from '../../../../../components/fileUpload/upload'
  import {baseURL} from '../../../../../config/global.toml'
  import KalixSelect from '../../../../../components/corelib/components/common/baseSelect'
  export default {
    name: 'reportVideoAdd',
    components: {KalixSelect, KalixClansmanUpload},
    data() {
      // let validateHospitalName = (rule, value, callback) => {
      //   if (value === null) {
      //     callback(new Error('请选择'))
      //   } else {
      //     this.axios.request({
      //       method: 'GET',
      //       url: ReportVideoURL + '/existUserBeanByLoginName/',
      //       data: '',
      //       params: {
      //         rId: value
      //       }
      //     }).then(response => {
      //       if (response.data) {
      //         callback(new Error('该档案已上传视频'))
      //       } else {
      //         callback()
      //       }
      //     }).catch(() => {
      //     })
      //   }
      // }
      return {
        formModel: Object.assign({}, FormModel),
        action: baseURL + '/camel/rest/upload',
        rules: {
          // rId: [{required: true, validator: validateHospitalName, trigger: 'blur'}]
        },
        targetURL: ReportVideoURL,
        labelWidth: '150px'
      }
    }
  }
</script>

<style scoped lang="stylus" type="text/stylus">
  .el-form
    width 70%
    margin auto
    .el-input
      width 70%
    .radio
      margin-left 20px
      .el-radio
        color: #3465cb
        font-weight: bold
        font-size: 14px
</style>
